package com.byxm.wlgw.control.admin;

import java.util.List;
import java.util.Map;

import com.byxm.wlgw.bean.XxBean;
import com.byxm.wlgw.control.BaseAction;
import com.byxm.wlgw.service.XxService;

public class XxAction  extends BaseAction{
	private static final long serialVersionUID = 1L;
	
//	private String xxid=null;
	
	private Map<String,List<XxBean>> xxMaps;
	
	private List<XxBean> lstXx;
	
	private XxBean xxBean;

	private boolean bflag=false;
	
	/***前台临时传回参数***/
	private String lsxxid="";


	/****service****/
	XxService xxService=new XxService();
	
	
	/**
	 * 用于生成左边菜项的
	 * @return
	 */
	public String find(){
		try {
			xxMaps=xxService.findXxList();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "success_01";
	}
	/**
	 * 查看所有父菜单
	 * @return
	 */
	public String findlist(){
		String resultStr="";
		if(lsxxid.trim()==""){
			xxBean=new XxBean();
			lstXx=xxService.findXxlistByXx(xxBean);
			resultStr="success_02";
		}
		if(lsxxid.trim()!=""){
			xxBean=new XxBean();
			xxBean.setXxid(Integer.parseInt(lsxxid));
			lstXx=xxService.findXxlistByXx(xxBean);
			resultStr="success_04";
		}
		
		return resultStr;
		
	}
	
	//保存
	public String save(){
		String resultStr="";
		
		try {
			xxService.saveXx(xxBean);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(xxBean.getFxxid()==0){
			resultStr="success_03";
		}
		if(xxBean.getFxxid()!=0){
			resultStr="success_05";
			lsxxid=xxBean.getFxxid()+"";
		}
		
		return resultStr;
	}
	//修改	
	public String update(){
		return null;
	}
	//删除
	public String delete(){
		try {
			bflag=xxService.delete(xxBean);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "json";
	}
	
	
	
	/********setter getter*********/
	public Map<String, List<XxBean>> getXxMaps() {
		return xxMaps;
	}

	public void setXxMaps(Map<String, List<XxBean>> xxMaps) {
		this.xxMaps = xxMaps;
	}

	public List<XxBean> getLstXx() {
		return lstXx;
	}
	public void setLstXx(List<XxBean> lstXx) {
		this.lstXx = lstXx;
	}
	public XxBean getXxBean() {
		return xxBean;
	}
	public void setXxBean(XxBean xxBean) {
		this.xxBean = xxBean;
	}
	public boolean isBflag() {
		return bflag;
	}
	public void setBflag(boolean bflag) {
		this.bflag = bflag;
	}
	public String getLsxxid() {
		return lsxxid;
	}
	public void setLsxxid(String lsxxid) {
		this.lsxxid = lsxxid;
	}

	
	
	
	
}
